package per.qiao.simplerest.restargument;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RestArgumentValue {
        /**
         * rest风格的参数
         */
        List<Object> restfulValues;

        /**
         * RequestParam(formData)这种的参数值 k->参数名, v->参数值
         */
        Map<String, Object> requestParamValues;

        /**
         * RequestBody 这种的参数值
         */
        Object bodyValue;

        public Object[] getRestfulValues() {
            return restfulValues == null ? new Object[0] : restfulValues.toArray(new Object[0]);
        }

        public void addRestfulValue(Object restfulValue) {
            if (restfulValues == null) {
                restfulValues = new ArrayList<>();
            }
            restfulValues.add(restfulValue);
        }

        public Map<String, Object> getRequestParamValues() {
            return requestParamValues;
        }

        public void addRequestParamValue(String name, Object requestParamValue) {
            if (requestParamValues == null) {
                requestParamValues = new HashMap<>();
            }
            requestParamValues.put(name, requestParamValue);
        }

        public Object getBodyValue() {
            return bodyValue;
        }

        public void setBodyValue(Object bodyValue) {
            this.bodyValue = bodyValue;
        }

    }